import { sumStatisticsExam, sumStatisticsExamType, sumStatisticsCourseType, sumStatisticsCourse } from '@/api/statistics'
import { postStatisticsDistrict, statisticsPostTrend, sumStatisticsPost } from '@/api/post'
const getDefaultState = () => {
  return {}
}

const state = getDefaultState()

const mutations = {}

const actions = {
  // 总数统计
  async sumStatisticsExam() {
    return new Promise((resolve, reject) => {
      sumStatisticsExam()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },

  // 类型分类
  async sumStatisticsExamType() {
    return new Promise((resolve, reject) => {
      sumStatisticsExamType()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },

  // 总数统计
  async sumStatisticsCourse() {
    return new Promise((resolve, reject) => {
      sumStatisticsCourse()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },

  // 类型分类
  async sumStatisticsCourseType() {
    return new Promise((resolve, reject) => {
      sumStatisticsCourseType()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
  // 岗位分类趋势分析
  async statisticsPostTrend({ state }) {
    return new Promise((resolve, reject) => {
      statisticsPostTrend()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
  // 岗位分类总数分析
  async sumStatisticsPost() {
    return new Promise((resolve, reject) => {
      sumStatisticsPost()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
  // 岗位分类总数分析
  async postStatisticsDistrict() {
    return new Promise((resolve, reject) => {
      postStatisticsDistrict()
        .then((response) => {
          resolve(response)
        })
        .catch((error) => {
          reject(error)
        })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
}
